﻿-- ============================================================
-- MembershipRole Reference Data Synchronization Script
-- ============================================================

CREATE TABLE #MembershipRole
(
	[Name] [nchar](50) COLLATE Latin1_General_CI_AS_KS_WS NOT NULL,
	[Desc] [nvarchar](100) COLLATE Latin1_General_CI_AS_KS_WS NULL
);

SET NOCOUNT ON;

INSERT #MembershipRole ([Name], [Desc]) VALUES (N'Administrators', N'Site administrators')
INSERT #MembershipRole ([Name], [Desc]) VALUES (N'Customers', N'Customers')
INSERT #MembershipRole ([Name], [Desc]) VALUES (N'Guests', N'Guest')

MERGE [dbo].[MembershipRole] AS Target
	USING #MembershipRole AS Source ON (Target.[Name] = Source.[Name])
		--WHEN MATCHED THEN 
		--	UPDATE SET Target.[Name] = Source.[Name]
		--			  ,Target.[Desc] = Source.[Desc]
		WHEN NOT MATCHED BY TARGET THEN
			INSERT ([Name], [Desc])
			VALUES (Source.[Name], Source.[Desc]);


DROP TABLE #MembershipRole;

GO
